(function() {
    document.oncontextmenu = function(e) {
        e = e || window.event;
        e.preventDefault();
        e.cancelBubble = true;
        var old = document.getElementById("old");
        var div = document.createElement("div");
        if(old)document.body.removeChild(old);
        div.style.cssText = "position:fixed;width:100px;height:25px;line-height:25px;background: -webkit-linear-gradient(left,#5587E8,#42FE5D);text-align:center;color:#fff;font-size:16px;font-weight:bold;cursor:pointer;"
        div.style.left = e.clientX + "px";
        div.style.top = e.clientY + "px";
        div.id="old";
        div.innerHTML = "关闭本页"
        div.onclick = function(e) {
            window.close()
        }
        div.onmousedown = function(e) {
            e.cancelBubble = true;
        }
        document.body.appendChild(div);
        document.onmousedown = function(e) {
            e = e || window.event;
            e.cancelBubble = true;
            document.body.removeChild(div)
            document.onmousedown = null;
        }
    }
})()